var express = require('express');
var router = express.Router();
var mysql = require('mysql')

var connection = mysql.createConnection({
    host: '47.98.34.232',
    user: 'yurui',
    password: '123456',
    database: 'students',//数据库名
    port: 3306,   //端口号
    useConnectionPooling: true
});

router.get('/', function (req, res, next) {
    connection.query('select * from water', function (err, rows, fields) {
        if (err) {
            res.send("err");
            console.log(err)
            return;
        }
        res.send(rows);
    })
});

module.exports = router;